import geoJson from './assets/geojson.china.json';
import { fontConfig } from '../commonSetting';

export default {
  name: '2.5D地图',
  code: 'custom_map_group_pseudo3D',
  version: '1.0.0',
  config: [
    {
      code: 'area',
      name: '区域设置',
      children: [
        {
          name: '边界粗细',
          code: 'borderWidth',
          min: 0,
          value: 1,
          type: 'InputNumber',
          unit: 'px',
        },
        {
          name: '边界颜色',
          code: 'borderColor',
          value: '#43EFFF',
          type: 'ColorSelector',
        },
        {
          name: '填充颜色',
          code: 'areaColors',
          type: 'RangeColors',
          min: 1,
          value: [
            {
              start: 0,
              end: 20,
              color: '#39FBDA',
            },
            {
              start: 20,
              end: 50,
              color: '#FFE455',
            },
            {
              start: 50,
              end: 80,
              color: '#FF7959',
            },
            {
              start: 80,
              end: 100,
              color: '#D83854',
            },
          ],
          template: {
            start: 0,
            end: 100,
            color: '#D83854',
          },
        },
      ],
    },
    {
      name: '提示框设置',
      code: 'tooltip',
      children: [
        {
          code: 'show',
          value: 'hover',
          type: 'Radio',
          enumValue: [
            {
              key: '无提示',
              value: 'hide',
            },
            {
              key: '提示一直存在',
              value: 'always',
            },
            {
              key: '鼠标划过提示',
              value: 'hover',
            },
            {
              key: '点击提示',
              value: 'click',
            },
          ],
        },
        fontConfig,
        {
          name: '边框线条粗细',
          code: 'borderWidth',
          min: 0,
          value: 1,
          type: 'InputNumber',
          unit: 'px',
        },
        {
          name: '边框线条色',
          code: 'borderColor',
          value: '#3399CC',
          type: 'ColorSelector',
        },
        {
          name: '背景来源',
          code: 'background',
          type: 'ChangeConfig',
          value: {
            type: 'color',
            backgroundColor: '#369',
            imageUrl: '',
          },
          enumValue: [
            {
              key: '颜色背景',
              value: 'color',
              change: [
                {
                  name: '背景颜色设置',
                  code: 'backgroundColor',
                  type: 'ColorSelector',
                },
              ],
            },
            {
              key: '图片背景',
              value: 'image',
              change: [
                {
                  name: '背景图片地址',
                  code: 'imageUrl',
                  type: 'ImgUpdate',
                },
              ],
            },
          ],
        },
      ],
    },
    {
      name: '通用设置',
      code: 'common',
      children: [
        {
          name: '底图颜色',
          code: 'backgroundColor',
          value: '#053556',
          type: 'ColorSelector',
        },
        {
          name: '底图外轮廓颜色',
          code: 'outlineColor',
          value: 'rgba(67, 239, 255, 0.4)',
          type: 'ColorSelector',
        },
        {
          name: '底图内填充颜色',
          code: 'backgroundInnerColor',
          value: 'rgba(5, 19, 47, .8)',
          type: 'ColorSelector',
        },
        {
          name: '选中文本',
          code: 'activeFont',
          type: 'FontGroup',
          value: {
            fontSize: 32,
            fontFamily: 'siyuan',
            color: '#FFF',
            fontWeight: 'normal',
          },
        },
      ],
    },
  ],
  data: {
    type: 1,
    field: [
      { name: 'id', mapper: 'features.properties.id' },
      { name: 'coords', mapper: 'features.geometry.coordinates' },
      { name: 'type', mapper: 'features.geometry.type', optional: true },
      { name: 'value', mapper: 'features.properties.level', optional: true },
      { name: 'name', mapper: 'features.properties.name', optional: true },
      { name: 'info', mapper: 'features.properties.tooltip', optional: true },
    ],
    value: JSON.stringify(geoJson),
  },
  events: {
    click: {
      description: '区域点击响应事件',
      fields: {
        info: {
          mapper: '',
          description: '区域info',
          value: '',
        },
      },
      action: {
        active: false,
        useDefault: false,
        default: {
          info: '',
        },
      },
    },
  },
};
